import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Picker, Swiper, SwiperItem } from '@tarojs/components'
import { AtSearchBar, AtGrid, AtForm, AtInput, AtList, AtListItem, AtTabBar, AtButton } from 'taro-ui'
import './huanzheshouye.css'
import app from '../../../main.js'
import { $navigateTo, $redirectTo, getGlobalData } from '../../../global'


export default class Huanzheshouye extends Component {
  config = {
    navigationBarTitleText: '患者首页'
  }
  constructor() {
    super(...arguments)
    this.state = {
      current: 0
    }
  }
  handleClick(value) {
    this.setState({
      current: value
    })
    if (value == 0) {
      app.redirectTo("../huanzheshouye/huanzheshouye")
    } else if (value == 1) {
      app.redirectTo("../gerenzhongxinzhuye/index")
    }
  }
  sousuo = () => {
    $navigateTo("../sousuomukuai/index")
  }
  wenzhen = (item, index) => {
    switch (index) {
      case 0: $navigateTo('../chooseconsultation/chooseconsultation?page=huanzheshouye');
        break;
      case 1: $navigateTo('../chooseexpert/chooseexpert?type=inquiry');
        break;
      // case 2: $navigateTo('../chooseexpert/chooseexpert?type=reservation');
      //   break;
      // case 3: $navigateTo('../chooseexpert/chooseexpert?type=surgery');
      //   break;
      case 3: $navigateTo('../kepushipin/index');
        break;
    }
  }
  zhuanjia = () => {
    $navigateTo("../tuijianzhuanjia/index")
  }
  yisheng = () => {
    $navigateTo("../doctorpage/doctorpage")
  }
  componentWillMount() { }
  componentDidMount() { }
  componentWillUnmount() { }
  componentDidShow() { }
  componentDidHide() { }

  render() {
    return (
      <View className='huanzheshouye'>
        <AtSearchBar onActionClick={this.sousuo}></AtSearchBar>
        <View>
          <Image className=' class_0' src={getGlobalData('baseurl') + 'img/paobutu.png'}></Image>
        </View>
        <AtGrid className=' class_1' onClick={this.wenzhen} data={
          [
            { image: getGlobalData('baseurl') + 'img/faqisuifang.png', value: '快速问诊' }, 
            { image: getGlobalData('baseurl') + 'img/zhuanjia.png', value: '专家问诊' }, 
            // { image: getGlobalData('baseurl') + 'img/zuijinyuyue.png', value: '专家预约' }, 
            // { image: getGlobalData('baseurl') + 'img/fenxiang.png', value: '手术预约' }, 
            { image: getGlobalData('baseurl') + 'img/shipin.png', value: '科普视频' }
          ]
        } >
        </AtGrid>
        <AtList>
          <AtListItem onClick={this.zhuanjia} title='推荐专家' arrow='right'></AtListItem>
          <AtListItem onClick={this.yisheng} hasBorder={false} title='李医生' note='广州医科大学附属医院' extraText='主任医师' thumb={getGlobalData('baseurl') + 'img/d2.jpg'} arrow='right'></AtListItem>
          <AtListItem onClick={this.yisheng} hasBorder={false} title='张医生' note='广州医科大学附属医院' extraText='主任医师' thumb={getGlobalData('baseurl') + 'img/d3.jpg'} arrow='right'></AtListItem>
        </AtList>
        <AtTabBar
          fixed
          tabList={[
            { title: '首页', iconType: 'home' },
            { title: '个人中心', iconType: 'user' }
          ]}
          onClick={this.handleClick.bind(this)}
          current={this.state.current}
        />
      </View>
    );
  }
}
